package cn.tedu.ems.configuration;

import cn.tedu.ems.interceptors.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new MyInterceptor1());// 将自定义的拦截器注册到拦截器链中,这样就能使用了

        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/v1/ems/**")
                .excludePathPatterns("/v1/ems/login");
    }

}
